package com.huike.review.Controller;

import com.huike.review.pojo.Review;
import com.huike.review.service.ReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @title: reviewController
 * @Author 椎名真白
 * @Date: 2022-05-15 11:04
 * @Version 1.0
 */

@RestController
@RequestMapping("review")
public class reviewController {
    @Autowired
    private ReviewService reviewService;
    @PutMapping
    public void add(@RequestBody Review review){
        reviewService.add(review);
    }
    @PostMapping()
    public void update(@RequestBody Review review){
        reviewService.updateById(review);
    }
    @DeleteMapping("{id}")
    public void delete(@PathVariable int id){
        reviewService.deleteById(id);
    }
    @GetMapping("{id}")
    public void select(@PathVariable int id){
        Review review = reviewService.selectById(id);
        System.out.println(review);
    }
}
